//////////////////////////////////////////////////
// glRenderer.h
//
// Author: Tarik Belabbas et Adrien Hoffer
//////////////////////////////////////////////////

#ifndef GLRENDERER_H_
#define GLRENDERER_H_

// Required to use VBOs (glGenBuffers() & co)
// and must be defined BEFORE including glext.h (included by QtOpenGL)
#define GL_GLEXT_PROTOTYPES

#include "glCamera.h"
#include "glVertexBO.h"
#include "glStore.h"

class glShaderProgram;
class glCamera;

class glRenderer
{
	ST_DECLARE_SINGLETON( glRenderer );

public:
	glRenderer	();
	~glRenderer	();

	void	initialize		();

	void	render			();

	void	resizeViewport	( int _width, int _height );

	// Camera management
	void	enableCamFlag	( glECameraMovementFlag _flag )	{ m_camera->enableCamFlag( _flag ); }
	void	disableCamFlag	( glECameraMovementFlag _flag )	{ m_camera->disableCamFlag( _flag ); }

	void	rotateCameraX	( float _angleX )	{ m_camera->rotateX( _angleX ); }
	void	rotateCameraY	( float _angleY )	{ m_camera->rotateY( _angleY ); }

	void	moveCameraTo	( float _posX, float _posY, float _posZ );

	void	addFire			( float _posX, float _posY, float _posZ );

private:
	void	initializeAxis	();
	void	renderAxis		();
	void	initializeCube	();
	void	renderCube		();


	// Members
	glStore< float >		m_attributes;
	glVertexBO				m_vertexBO;

	glShaderProgram*	m_shaderProgram;
	glCamera*			m_camera;
};

#endif /* GLRENDERER_H_ */
